import Vue from 'vue'

Vue.directive('pf', function (el, binding) {
  const PREFIX = 'tu-'
  const hasReg = new RegExp(`^${PREFIX}`, 'g')
  const classList = Array.from(el.classList)
  classList.forEach((name, index) => {
    if (hasReg.test(name)) { return hasReg.test(name) }
    classList[index] = `${PREFIX}${name}`
  })
  el.classList = classList.join(' ')
})
